<?php

require_once  $_SERVER['DOCUMENT_ROOT']."/../_lib/base/common.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.template.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.holidays.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.destinations.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.exchange_rates.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.airports.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.lurls.php";
	
	// Start Sessions
	//session_start();
	//header("Cache-control: private");
			
	
	$holidays = new holidays();
	$airports = new airports();
	$destinations = new destinations();
	$lurls = new lurls();
	$tree = new tree();
	

	// Prepare search criteria
	$holiday_search_params = preprocess_search_form();
	
	// Create the request string
	$request = $holidays->create_grq_query($holiday_search_params);

	// Get the results
	$key = md5("micros_params_".implode(',',$holiday_search_params));
	
	
	$memcache = new Memcache;
	foreach(unserialize(CHOSTS) as $cache_server){
		 $memcache->addServer($cache_server, 11211);
	}
	
	
	//lookup value in memcache
	$result = $memcache->get($key);
			 
	if($result){
		$holiday_search_response = $result;
	}else{
		$holiday_search_response = $holidays->connection_sabs($request);
		// Set cache
		$memcache->set($key,$holiday_search_response,0,600);
	}
	
	unset($holiday_search_params);
	

	
	// Get meta tag description string
	$template = new template();
	$template->title = "Last minute holiday deals, book online";
	$template->meta_description = "Last minute holidays from Ireland to Lanzarote, Majorca, Portugal and more. Book online and save up to 30%";
	$template->section_highlight = "last";
	$template->search_tab = "holidays";
	$template->left_col = true;
	$template->ld_head();
	
	
	

?>



<div class="box_title_h2">
<div class="box_title_h2_wm box_title_h2_wm_5">

	<h2>Last Minute Holidays</h2>
	<p>Last minute holidays from Ireland to all the top holiday destinations in Europe</p>
    
</div>
</div>



<?

require_once SITE_ROOT_PATH."/_lib/html/holiday_results_group.php";

	
	
	
	$template->ld_foot();





function preprocess_search_form() {

	$holiday_search = array();
	
	$holiday_search['give_take'] = '6';
	$holiday_search['destination_airport'] = '';
	$holiday_search['nights'] = '';
	$holiday_search['departure_airport'] = '*IRL';
	$holiday_search['pax_adult'] = 2;
	$holiday_search['pax_child'] = 0;
	$holiday_search['departure_date'] = date('ymd',strtotime('+12 days'));	

    return $holiday_search;
}

	
?>